From 9e92a72fb5e29900dd1bc57cf0592d916a03a109 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Thu, 8 Mar 2007 23:47:24 +0000 Subject: [PATCH] Added {VIF,VBD}.{plug,unplug} methods. Docs and C bindings -- Xend to follow. Signed-off-by: Ewan Mellor --- docs/xen-api/xenapi-datamodel.tex | 130 ++++++++++++++++++++++++++++++ tools/libxen/include/xen_vbd.h | 16 ++++ tools/libxen/include/xen_vif.h | 16 ++++ tools/libxen/src/xen_vbd.c | 28 +++++++ tools/libxen/src/xen_vif.c | 28 +++++++ 5 files changed, 218 insertions(+) diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index c7b7496509..02ef2e90bd 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -7118,6 +7118,71 @@ $\mathit{RO}_\mathit{run}$ & {\tt metrics} & VIF\_metrics ref & metrics associa \hline \end{longtable} \subsection{Additional RPCs associated with class: VIF} +\subsubsection{RPC name:~plug} + +{\bf Overview:} +Hotplug the specified VIF, dynamically attaching it to the running VM. + + \noindent {\bf Signature:} +\begin{verbatim} void plug (session_id s, VIF ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VIF ref } & self & The VIF to hotplug \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~unplug} + +{\bf Overview:} +Hot-unplug the specified VIF, dynamically unattaching it from the running +VM. + + \noindent {\bf Signature:} +\begin{verbatim} void unplug (session_id s, VIF ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VIF ref } & self & The VIF to hot-unplug \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} \subsubsection{RPC name:~get\_all} {\bf Overview:} @@ -10461,6 +10526,71 @@ void +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~plug} + +{\bf Overview:} +Hotplug the specified VBD, dynamically attaching it to the running VM. + + \noindent {\bf Signature:} +\begin{verbatim} void plug (session_id s, VBD ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VBD ref } & self & The VBD to hotplug \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~unplug} + +{\bf Overview:} +Hot-unplug the specified VBD, dynamically unattaching it from the running +VM. + + \noindent {\bf Signature:} +\begin{verbatim} void unplug (session_id s, VBD ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VBD ref } & self & The VBD to hot-unplug \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} diff --git a/tools/libxen/include/xen_vbd.h b/tools/libxen/include/xen_vbd.h index 86ad38f207..7b36266a04 100644 --- a/tools/libxen/include/xen_vbd.h +++ b/tools/libxen/include/xen_vbd.h @@ -357,6 +357,22 @@ extern bool xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi); +/** + * Hotplug the specified VBD, dynamically attaching it to the running + * VM + */ +extern bool +xen_vbd_plug(xen_session *session, xen_vbd self); + + +/** + * Hot-unplug the specified VBD, dynamically unattaching it from the + * running VM + */ +extern bool +xen_vbd_unplug(xen_session *session, xen_vbd self); + + /** * Return a list of all the VBDs known to the system. */ diff --git a/tools/libxen/include/xen_vif.h b/tools/libxen/include/xen_vif.h index 05a070aff4..8a1cffb7bd 100644 --- a/tools/libxen/include/xen_vif.h +++ b/tools/libxen/include/xen_vif.h @@ -331,6 +331,22 @@ extern bool xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key); +/** + * Hotplug the specified VIF, dynamically attaching it to the running + * VM + */ +extern bool +xen_vif_plug(xen_session *session, xen_vif self); + + +/** + * Hot-unplug the specified VIF, dynamically unattaching it from the + * running VM + */ +extern bool +xen_vif_unplug(xen_session *session, xen_vif self); + + /** * Return a list of all the VIFs known to the system. */ diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c index def7403ef9..300f1d857d 100644 --- a/tools/libxen/src/xen_vbd.c +++ b/tools/libxen/src/xen_vbd.c @@ -551,6 +551,34 @@ xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi) } +bool +xen_vbd_plug(xen_session *session, xen_vbd self) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = self } + }; + + xen_call_(session, "VBD.plug", param_values, 1, NULL, NULL); + return session->ok; +} + + +bool +xen_vbd_unplug(xen_session *session, xen_vbd self) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = self } + }; + + xen_call_(session, "VBD.unplug", param_values, 1, NULL, NULL); + return session->ok; +} + + bool xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result) { diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c index 11cba1dcbd..a139a83bc3 100644 --- a/tools/libxen/src/xen_vif.c +++ b/tools/libxen/src/xen_vif.c @@ -499,6 +499,34 @@ xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char } +bool +xen_vif_plug(xen_session *session, xen_vif self) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = self } + }; + + xen_call_(session, "VIF.plug", param_values, 1, NULL, NULL); + return session->ok; +} + + +bool +xen_vif_unplug(xen_session *session, xen_vif self) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = self } + }; + + xen_call_(session, "VIF.unplug", param_values, 1, NULL, NULL); + return session->ok; +} + + bool xen_vif_get_all(xen_session *session, struct xen_vif_set **result) { -- 2.30.2